// 施工方案管理

import request from "./axios";

export const ConstructionSchemeAPI = {
  getList: (params) => request.get("/entities/ConstructionScheme", { params }),

  create: (data) => request.post("/entities/ConstructionScheme", data),

  get: (id) => request.get(`/entities/ConstructionScheme/${id}`),

  update: (id, data) => request.put(`/entities/ConstructionScheme/${id}`, data),

  delete: (id) => request.delete(`/entities/ConstructionScheme/${id}`),

  filter: (id) =>
    request.get(`/entities/ConstructionScheme?crossingPointId=${id}`),

  getLengthList: (id) => 
    request.get(`/entities/ConstructionScheme/engineeringParameter?schemeId=${id}`),

// /entities/ConstructionScheme/engineeringParameter

  filterTensionSectionId: (id) =>
    request.get(`/entities/ConstructionScheme?tensionSectionId=${id}`),
  schemeList: (data) =>
    request.get(`/entities/ConstructionScheme?crossingPointIdList=${data}`),

  // 生成word文档
  exportWord: (id) => {
    return request.get(`/entities/ConstructionScheme/exportWord?id=${id}`, {
      responseType: "blob", // 关键：指定响应类型为blob
      timeout: 60000,
      keepResponse: true, // 文档生成可能耗时较长，延长超时时间
    });
  },
};
